            <html xmlns:saxon="http://icl.com/saxon">
   <head>
      <link rel="stylesheet" type="text/css" href="doc.css"/>
      <link rel="stylesheet" type="text/css" href=""/>
      <meta author="The MathWorks Ltd."/>
      <meta copyright="2011 The MathWorks Ltd."/>
      <title>Using layouts inside GUIDE GUIs</title>
   </head>

   
   <body>
      <table class="header" width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
            <td bgcolor="#e4f0f8"><A href="User guide.html"><font face="Arial" bgcolor="#e4f0f8" size="+0" underline="0" color="#000000"><b>User guide</b></font></A></td>
            <td width="36" bgcolor="#e4f0f8"><A HREF="User guide5_3.html"><IMG SRC="Images/leftarrow.png" BORDER="0" ALT="previous page"/></A><A HREF="User guide7.html"><IMG SRC="Images/rightarrow.png" BORDER="0" ALT="next page"/></A></td>
         </tr>
      </table>
   

      <h2>6: Using layouts inside GUIDE GUIs&nbsp;<A href="User guide.html"><img src="Images/uparrow.png" border="0" align="top" alt="Go back up one level"/></A></h2>
      
        
        <p>Whilst the layouts in this toolbox do not integrate into the
        MATLAB Graphical User Interface Design Environment (<a href="matlab:doc GUIDE"><code class="FUNCTION">GUIDE</code></a>), it
    is possible to insert layouts into a GUIDE-built GUI as follows:</p>
        <h4>Create the GUIDE GUI</h4>
            <p>Create you GUIDE application as usual, placing a panel where you
        want to insert the layout. You can turn the panel border and title
    off if you do not want them.</p>
        <center><img src="Images/guide1.png"/></center>

        <h4>Insert the layout</h4>
        <p>Edit the "OpeningFcn" in the GUIDE-created code and insert your
    layout into the panel, making it fill the space. In the example below
four boxpanels are inserted into a grid, which itself is placed inside
        <code>uipanel1</code>:</p>
        <example>
            <pre style="background-color: #eeeeff; margin-left: 20px; margin-right: 20px"><font color="#000011"><code class="COMMENT">% --- Executes just before guideApp is made visible.</code>&nbsp;
<a href="matlab:doc function"><code class="FUNCTION">function</code></a> guideApp_OpeningFcn(hObject, eventdata, handles, varargin)

<code class="COMMENT">% Choose default command line output for guideApp</code>&nbsp;
handles.output = hObject;

<code class="COMMENT">% Update handles structure</code>&nbsp;
guidata(hObject, handles);

<code class="COMMENT">% Put a layout in the panel</code>&nbsp;
g = <a href="uiextras.GridFlex.html"><code class="FUNCTION">uiextras.GridFlex</code></a>( <code class="STRING">'Parent'</code>, handles.uipanel1, ...
    <code class="STRING">'Units'</code>, <code class="STRING">'Normalized'</code>, <code class="STRING">'Position'</code>, [0 0 1 1], ...
    <code class="STRING">'Spacing'</code>, 5 );
<a href="uiextras.BoxPanel.html"><code class="FUNCTION">uiextras.BoxPanel</code></a>( <code class="STRING">'Parent'</code>, g, <code class="STRING">'Title'</code>, <code class="STRING">'Panel 1'</code> );
<a href="uiextras.BoxPanel.html"><code class="FUNCTION">uiextras.BoxPanel</code></a>( <code class="STRING">'Parent'</code>, g, <code class="STRING">'Title'</code>, <code class="STRING">'Panel 2'</code> );
<a href="uiextras.BoxPanel.html"><code class="FUNCTION">uiextras.BoxPanel</code></a>( <code class="STRING">'Parent'</code>, g, <code class="STRING">'Title'</code>, <code class="STRING">'Panel 3'</code> );
<a href="uiextras.BoxPanel.html"><code class="FUNCTION">uiextras.BoxPanel</code></a>( <code class="STRING">'Parent'</code>, g, <code class="STRING">'Title'</code>, <code class="STRING">'Panel 4'</code> );
g.RowSizes = [-1 -1];</font></pre>
            <p style="background-color: #ddddee; margin-left: 20px; margin-right: 20px"><font color="#000022"><center><img src="Images/guide2.png"/></center></font></p>
        </example>
                         <p><small>(Full source code for this application is available here: 
                     [ <a href="Examples/guideApp.m">view</a>
                     | <a href="matlab: edit(fullfile(layoutRoot,'layoutHelp','Examples','guideApp.m'))">edit</a>
                     | <a href="matlab: p=pwd();cd(fullfile(layoutRoot,'layoutHelp','Examples')); guideApp; cd(p)">run</a> ]
                 )</small></p>

    
      
      <br clear="ALL"/>
      <table class="footer" width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
            <td width="18" height="15" bgcolor="#e4f0f8" align="left"><a href="User guide5_3.html"><img src="images/leftarrow.png" border="0" alt="previous page"/></a></td>
            <td width="40%" height="15" bgcolor="#e4f0f8" align="left"><a href="User guide5_3.html"><font face="arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">Dock and undock</font></a></td>
            <td width="20%" height="15" bgcolor="#e4f0f8" align="center"><a href="index.html"><font face="arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">[Top]</font></a></td>
            <td width="40%" height="15" bgcolor="#e4f0f8" align="right"><a href="User guide7.html"><font face="arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">Deploying GUIs using the MATLAB Compiler</font></a></td>
            <td width="18" height="15" bgcolor="#e4f0f8" align="right"><a href="User guide7.html"><img src="images/rightarrow.png" border="0" alt="next page"/></a></td>
         </tr>
      </table>
      <font face="Arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">&copy; 2011 The MathWorks Ltd</font>
      <TT>&#149; </TT><a href="matlab: helpview([matlabroot,'/license.txt'])">Terms of Use</a>
      <TT>&#149; </TT><a href="matlab: helpview([matlabroot,'/patents.txt'])">Patents</a>
      <TT>&#149; </TT><a href="matlab: helpview([matlabroot,'/trademarks.txt'])">Trademarks</a>
   
   </body>
</html>

            
